package two_xia.ex9.Demo06;

class Chessman {
    private String name;
    private String state;

    public Chessman(String name) {
        this.name = name;
        this.state = "位置不变……";
    }

    public void move() {
        this.state = "移动了……";
    }

    public Memento saveState() {
        return new Memento(state);
    }

    public void restoreState(Memento memento) {
        this.state = memento.getState();
    }

    public void showState() {
        System.out.println(name + "当前状态：" + state);
    }
}